<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	Jan 23, 2011
 ^
 + Project: 		WRecruit
 * File Name:	views/employer/tmpl/myjobs.php
 ^ 
 * Description: template view for my jobs
 ^ 
 * History:		NONE
 ^ 
 */
 
 defined('_JEXEC') or die('Restricted access');
 
 jimport('joomla.application.component.model');
 global $mainframe;
 $document =& JFactory::getDocument();
 $document->addStyleSheet('components/com_wrecruit/css/'.$this->config['theme']);
   
?>

<?php if ($this->config['offline'] == '1'){ ?>
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	<?php echo $this->config['title']; ?></td></tr>
	<tr><td height="25"></td></tr>
	<tr><td class="wrecruitmsg">
		<?php echo $this->config['offline_text']; ?>
	</td></tr>
</table>	
<?php }else{ ?>

<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	
		<?php echo $this->config['title']; ?>
	</td>
	</tr>
	<tr><td height="23"></td></tr>
	<?php if ($this->config['cur_location'] == 1) {?>
	<tr><td class="curloc">
                <?php if($this->vm == 1){ // job_appliedapplications ?>
			<?php echo JText::_('JS_CUR_LOC'); ?> : <a href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=alljobsappliedapplications&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_APPLIED_RESUME'); ?></a> > <a href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=job_appliedapplications&bd=<?php echo $this->bd; ?>&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_JOB_APPLIED_APPLICATIONS'); ?></a> > <?php echo JText::_('JS_SEND_MESSAGE'); ?>
                <?php }elseif($this->vm == 2){ // job_job messages ?>
			<?php echo JText::_('JS_CUR_LOC'); ?> : <a href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=empmessages&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_MESSAGES'); ?></a> > <a href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=job_messages&bd=<?php echo $this->bd; ?>&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_JOB_MESSAGES'); ?></a> > <?php echo JText::_('JS_SEND_MESSAGE'); ?>
                <?php }elseif($this->vm == 3){ // js messages ?>
			<?php echo JText::_('JS_CUR_LOC'); ?> : <a href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=jsmessages&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_MESSAGES'); ?></a> > <?php echo JText::_('JS_SEND_MESSAGE'); ?>
                <?php }else{ ?>
		<?php echo JText::_('JS_CUR_LOC'); ?> : <?php echo JText::_('JS_SEND_MESSAGE'); ?>
                <?php } ?>
	</td></tr>
	<?php } ?>
	
		<?php
			if (sizeof($this->employerlinks) != 0){
				echo '<tr><td><div id="toplinks"><ul>';
				foreach($this->employerlinks as $lnk)	{ ?>
					<span <?php if($lnk[2] == 1)echo 'class="first"'; elseif($lnk[2] == -1)echo 'class="last"';  ?>>
						<a href="<?php echo $lnk[0]; ?>"> <?php echo $lnk[1]; ?></a>
					</span>
				<?php }
				echo '<ul></div></td></tr>';
			}
		?>
	
	
		<?php
			if (sizeof($this->jobseekerlinks) != 0){
				echo '<tr><td><div id="toplinks"><ul>';
				foreach($this->jobseekerlinks as $lnk)	{ ?>
					<span <?php if($lnk[2] == 1)echo 'class="first"'; elseif($lnk[2] == -1)echo 'class="last"';  ?>>
						<a href="<?php echo $lnk[0]; ?>"> <?php echo $lnk[1]; ?></a>
					</span>
				<?php }
				echo '<ul></div></td></tr>';
			}
		?>
	
	<tr><td height="3"></td></tr>
	<tr><td class="<?php echo $this->theme['heading']; ?>" align="center">
		<?php echo JText::_('JS_SEND_MESSAGE'); ?>
	</td></tr>
	<tr><td height="3"></td></tr>
</table>


<?php
if ($this->canadd == 1) { // employer

$trclass = array($this->theme['odd'], $this->theme['even']);
?>

<form action="index.php" method="post" name="adminForm">
	<table cellpadding="0" cellspacing="0" border="0" width="100%" >
            <tr class="<?php echo $trclass[1]; ?>">
                    <td width="33%">&nbsp;<strong><?php echo JText::_('JS_JOB'); ?>:</strong> <?php if(isset($this->summary)) echo $this->summary->title;?></td>
                    <td width="33%" >&nbsp;<strong><?php echo JText::_('JS_JOB_SEEKER'); ?>: </strong>
                    <?php if(isset($this->summary)) echo $this->summary->first_name; if ($this->summary->middle_name) echo ' '.$this->summary->middle_name; echo ' '.$this->summary->last_name; ?></td>
                    <td width="33%" >&nbsp;<strong><?php echo JText::_('JS_RESUME'); ?>: </strong><?php if(isset($this->summary)) echo $this->summary->application_title; ?></td>

            </tr>
            <tr><td height="15" colspan="3"></td></tr>
            <tr>
                <td colspan="3" align="center"><label id="titlemsg" for="title"><?php echo JText::_('JS_SUBJECT'); ?></label>&nbsp;<font color="red">*</font>
                <input class="inputbox required" type="text" name="subject" id="subject" size="90" maxlength="255" value="<?php if(isset($this->job)) echo $this->job->subject; ?>" />
                </td>
            </tr>
            <tr>
                    <td colspan="3" valign="top" align="center"><label id="messagemsg" for="message"><strong><?php echo JText::_('JS_MESSAGE'); ?></strong></label>&nbsp;<font color="red">*</font></td>
            </tr>
            <tr>
                    <td colspan="3" align="center">
                    <?php
                            $editor =& JFactory::getEditor();
                            if(isset($this->job))
                                    echo $editor->display('message', $this->job->message, '550', '300', '60', '20', false);
                            else
                                    echo $editor->display('message', '', '550', '300', '60', '20', false);

                    ?>
                    </td>
            </tr>
	<tr>
		<td colspan="3" align="center">
		<input class="button" type="submit" name="submit" onClick="return myValidate();" value="<?php echo JText::_('JS_SEND'); ?>" />
		</td>
	</tr>
            
        </table>
                        <?php if(isset($this->company)) {
                                if (($this->company->created=='0000-00-00 00:00:00') || ($this->company->created==''))
                                        $curdate = date('Y-m-d H:i:s');
                                else
                                        $curdate = $this->company->created;
                        }else{
                                $uid = $this->uid;
                                $curdate = date('Y-m-d H:i:s');
                        }
			?>
        <input type="hidden" name="created" value="<?php echo $curdate; ?>" />
       <input type="hidden" name="option" value="<?php echo $this->option; ?>" />
        <input type="hidden" name="task" value="savemessage" />
        <input type="hidden" id="id" name="id" value="" />
        <input type="hidden" id="employerid" name="employerid" value="<?php if(isset($this->summary)) echo $this->summary->employerid; ?>" />
        <input type="hidden" id="jobseekerid" name="jobseekerid" value="<?php if(isset($this->summary)) echo $this->summary->jobseekerid; ?>" />
        <input type="hidden" id="jobid" name="jobid" value="<?php if(isset($this->summary)) echo $this->summary->jobid; ?>" />
        <input type="hidden" id="resumeid" name="resumeid" value="<?php if(isset($this->summary)) echo $this->summary->resumeid; ?>" />
       <input type="hidden" name="vm" value="<?php echo $this->vm; ?>" />
        <input type="hidden" name="boxchecked" value="0" />
    </form>

            <table cellpadding="0" cellspacing="0" border="0" width="100%" >
                <tr><td colspan="3" class="<?php echo $this->theme['heading']; ?>" align="center">
                        <?php echo JText::_('JS_MESSAGE_HISTORY'); ?>
                </td></tr>
                <tr><td colspan="3" height="3"></td></tr>
        	<?php if ($this->totalresults != 0) { ?>
		
		<?php 
		$tdclass = array($this->theme['odd'], $this->theme['even']);
		$isodd =1;
		if ( isset($this->messages) ){?>
                        <tr class="<?php echo $trclass[1]; ?>">
                                <td width="33%">&nbsp;<strong><?php echo JText::_('JS_JOB'); ?>: </strong><?php echo $this->messages[0]->title;?></td>
                                <td width="33%" >&nbsp;<strong><?php echo JText::_('JS_JOB_SEEKER'); ?>: </strong>
                                <?php echo $this->messages[0]->first_name; if ($this->messages[0]->middle_name) echo ' '.$this->messages[0]->middle_name; echo ' '.$this->messages[0]->last_name; ?></td>
                                <td width="33%" >&nbsp;<strong><?php echo JText::_('JS_RESUME'); ?>: </strong><?php echo $this->messages[0]->application_title; ?></td>

                        </tr>
		<?php foreach($this->messages as $message)	{
			$isodd = 1 - $isodd; ?>
			<tr colspan="3" class="<?php echo $tdclass[$isodd]; ?>"> <td colspan="5">
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr>
						<td colspan="2" align="center">&nbsp;<strong>
                                                        <?php if ($this->uid == $message->sendby) echo JText::_('JS_YOU_SENT');
                                                              elseif($this->uid == $message->employerid) echo JText::_('JS_JOBSEEKER_SENT');
                                                              elseif($this->uid == $message->jobseekerid) echo JText::_('JS_EMPLOYER_SENT');
                                                        ?>
                                                    </strong><hr></td>
					</tr>
					<tr>
						<td width="15%">&nbsp;<strong><?php echo JText::_('JS_SUBJECT'); ?>	</strong></td>
						<td><?php echo $message->subject;?></td>
					</tr>
					<tr>
						<td >&nbsp;<strong><?php echo JText::_('JS_MESSAGE'); ?>	</strong></td>
						<td><?php echo $message->message; ?></td>
						
					</tr>
					<tr>
						<td >&nbsp;<strong><?php echo JText::_('JS_CREATED'); ?>	</strong></td>
						<td><?php echo $message->created; ?></td>

					</tr>
					<tr><td height="3"></td></tr>
				</table>	
			</td></tr>
		<?php 
		}
		}
            }else{ // no result found in this category
                    echo '<tr><td>'.JText::_('JS_MESSAGE_HISTORY_NOT_FOUND').'</td></tr>';
            }
                ?>
	</table>

<form action="<?php echo JRoute::_('index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=send_message&bd='.$this->bd.'&rd='.$this->rd.'&vm='.$this->vm.'&Itemid='.$this->Itemid); ?>" method="post">
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
    <tr>
        <td></td>
        <td >
            <?php
            echo $this->pagination->getPagesLinks();
            ?>
        </td>
    </tr>
    <tr>
        <td align="left">
            <?php echo JText::_('JS_DISPLAY_#'); ?>
            <?php
            echo $this->pagination->getLimitBox();
            ?>
        </td>
        <td align="right">
            <?php
            echo $this->pagination->getResultsCounter();
            ?>
        </td>
    </tr>
</table>
</form>	
<?php

} else{ // not allowed job posting
echo JText::_('JS_YOU_DONOT_HAVE_THIS_FEATURE');
}	
}//ol
?>	
<div width="100%">
<?php 
if($this->config['fr_cr_txsh']) {
	echo 
	'<table width="100%" style="table-layout:fixed;">
		<tr><td height="15"></td></tr>
		<tr><td style="vertical-align:top;" align="center">'.$this->config['fr_cr_txa'].$this->config['fr_cr_txb'].'</td></tr>
	</table>';
}	
?>
</div>


